var t = (0, require("../../../@babel/runtime/helpers/interopRequireDefault").default)(require("../../../utils/util")), a = new(require("../../../utils/http").HTTP);
Page({
    data: {
        num: 1,
        daily: !0,
        month: t.default.formatDates(new Date),
        addtoday: {
            add: "今日新增",
            follow: "今日跟进",
            exactly: "今日核名",
            addnow: "当日新增"
        },
        addfrom: !1,
        meetfrom: !1,
        namefrom: !1
    },
    changeOil: function (t) {
        var e = this;
        wx.showLoading({
            title: "加载中"
        }),
        setTimeout((function () {
                wx.hideLoading()
            }), 700),
        e.setData({
            num: t.target.dataset.num,
            addtoday: {
                add: "今日新增",
                follow: "今日跟进",
                exactly: "今日核名",
                addnow: "当日新增"
            }
        }),
        2 == e.data.num ? (e.setData({
                daily: !1,
                addtoday: {
                    add: "本月新增",
                    follow: "本月跟进",
                    exactly: "本月核名",
                    addnow: "本月新增"
                },
                addfrom: !1,
                meetfrom: !1,
                namefrom: !1
            }), a.request({
                url: "https://www.qlsyyun.com:3000/trader",
                data: {
                    month: e.data.month,
                    arr: 6,
                    zsy: e.data.user[0]
                }
            }).then((function (t) {
                    t.data.length > 0 ? e.setData({
                        total: t.data[0]
                    }) : e.setData({
                        total: {
                            jda: 0
                        }
                    }),
                    a.request({
                        url: "https://www.qlsyyun.com:3000/trader/lxb",
                        data: {
                            arr: 4,
                            month: e.data.month,
                            zsy: e.data.user[0]
                        }
                    }).then((function (t) {
                            if (0 == t.data.length)
                                e.setData({
                                    lxb: 0,
                                    perfumeNum: 1
                                });
                            else {
                                e.setData({
                                    lxb: t.data[0].lxb
                                });
                                var a = Number((e.data.lxb / e.data.total.jda).toFixed(2));
                                e.data.lxb > e.data.total.jda ? e.setData({
                                    perfumeNum: 2
                                }) : e.setData({
                                    perfumeNum: 1 + a
                                })
                            }
                        })),
                    a.request({
                        url: "https://www.qlsyyun.com:3000/trader",
                        data: {
                            month: e.data.month,
                            arr: 12,
                            zsy: e.data.user[0]
                        }
                    }).then((function (t) {
                            0 == t.data.length ? e.setData({
                                jda: 0,
                                jdba: 0,
                                jdd: 0
                            }) : e.setData({
                                jda: t.data[0].jda,
                                jdba: t.data[0].jdba,
                                jdd: t.data[0].jdd
                            })
                        })),
                    a.request({
                        url: "https://www.qlsyyun.com:3000/trader",
                        data: {
                            month: e.data.month,
                            arr: 13,
                            zsy: e.data.user[0]
                        }
                    }).then((function (t) {
                            0 !== t.data.length && e.setData({
                                addclient: t.data,
                                addfrom: !0
                            })
                        })),
                    a.request({
                        url: "https://www.qlsyyun.com:3000/trader",
                        data: {
                            month: e.data.month,
                            arr: 14,
                            zsy: e.data.user[0]
                        }
                    }).then((function (t) {
                            0 !== t.data.length && e.setData({
                                meetclient: t.data,
                                meetfrom: !0
                            })
                        })),
                    a.request({
                        url: "https://www.qlsyyun.com:3000/trader",
                        data: {
                            month: e.data.month,
                            arr: 15,
                            zsy: e.data.user[0]
                        }
                    }).then((function (t) {
                            0 !== t.data.length && e.setData({
                                nameclient: t.data,
                                namefrom: !0
                            })
                        }))
                }))) : (e.setData({
                daily: !0
            }), e.selectDay(t))
    },
    selectDay: function (t) {
        var e = this;
        e.setData({
            addfrom: !1,
            meetfrom: !1,
            namefrom: !1
        }),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.detail.month,
                day: t.detail.day,
                arr: 7,
                zsy: e.data.user[0]
            }
        }).then((function (d) {
                d.data.length > 0 ? e.setData({
                    total: d.data[0]
                }) : e.setData({
                    total: {
                        jda: 0
                    }
                }),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader/lxb",
                    data: {
                        month: t.detail.month,
                        day: t.detail.day,
                        arr: 3,
                        zsy: e.data.user[0]
                    }
                }).then((function (t) {
                        0 == t.data.length ? e.setData({
                            lxb: 0,
                            perfumeNum: 1
                        }) : e.setData({
                            lxb: t.data[0].lxb
                        });
                        var a = Number((e.data.lxb / e.data.total.jda).toFixed(2));
                        e.data.lxb > e.data.total.jda ? e.setData({
                            perfumeNum: 2
                        }) : e.setData({
                            perfumeNum: 1 + a
                        })
                    }))
            })),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.detail.month,
                day: t.detail.day,
                arr: 8,
                zsy: e.data.user[0]
            }
        }).then((function (t) {
                0 == t.data.length ? e.setData({
                    jda: 0,
                    jdba: 0,
                    jdd: 0
                }) : e.setData({
                    jda: t.data[0].jda,
                    jdba: t.data[0].jdba,
                    jdd: t.data[0].jdd
                })
            })),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.detail.month,
                day: t.detail.day,
                arr: 9,
                zsy: e.data.user[0]
            }
        }).then((function (t) {
                0 !== t.data.length && e.setData({
                    addclient: t.data,
                    addfrom: !0
                })
            })),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.detail.month,
                day: t.detail.day,
                arr: 10,
                zsy: e.data.user[0]
            }
        }).then((function (t) {
                0 !== t.data.length && e.setData({
                    meetclient: t.data,
                    meetfrom: !0
                })
            })),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.detail.month,
                day: t.detail.day,
                arr: 11,
                zsy: e.data.user[0]
            }
        }).then((function (t) {
                0 !== t.data.length && e.setData({
                    nameclient: t.data,
                    namefrom: !0
                })
            }))
    },
    lastmonth: function () {
        var t = this;
        wx.showLoading({
            title: "加载中"
        }),
        setTimeout((function () {
                wx.hideLoading()
            }), 300),
        t.data.month > 1 && t.setData({
            month: Number(t.data.month) - 1
        }),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.data.month,
                arr: 6,
                zsy: t.data.user[0]
            }
        }).then((function (e) {
                e.data.length > 0 ? t.setData({
                    total: e.data[0]
                }) : t.setData({
                    total: {
                        jda: 0
                    }
                }),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader/lxb",
                    data: {
                        arr: 4,
                        month: t.data.month,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        if (0 == a.data.length)
                            t.setData({
                                lxb: 0,
                                perfumeNum: 1
                            });
                        else {
                            t.setData({
                                lxb: a.data[0].lxb
                            });
                            var e = Number((t.data.lxb / t.data.total.jda).toFixed(2));
                            t.data.lxb > t.data.total.jda ? t.setData({
                                perfumeNum: 2
                            }) : t.setData({
                                perfumeNum: 1 + e
                            })
                        }
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 12,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 == a.data.length ? t.setData({
                            jda: 0,
                            jdba: 0,
                            jdd: 0
                        }) : t.setData({
                            jda: a.data[0].jda,
                            jdba: a.data[0].jdba,
                            jdd: a.data[0].jdd
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 13,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            addclient: a.data,
                            addfrom: !0
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 14,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            meetclient: a.data,
                            meetfrom: !0
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 15,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            nameclient: a.data,
                            namefrom: !0
                        })
                    }))
            }))
    },
    nextmonth: function () {
        var t = this;
        wx.showLoading({
            title: "加载中"
        }),
        setTimeout((function () {
                wx.hideLoading()
            }), 300),
        t.data.month < 12 && t.setData({
            month: Number(t.data.month) + 1
        }),
        a.request({
            url: "https://www.qlsyyun.com:3000/trader",
            data: {
                month: t.data.month,
                arr: 6,
                zsy: t.data.user[0]
            }
        }).then((function (e) {
                e.data.length > 0 ? t.setData({
                    total: e.data[0]
                }) : t.setData({
                    total: {
                        jda: 0
                    }
                }),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader/lxb",
                    data: {
                        arr: 4,
                        month: t.data.month,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        if (0 == a.data.length)
                            t.setData({
                                lxb: 0,
                                perfumeNum: 1
                            });
                        else {
                            t.setData({
                                lxb: a.data[0].lxb
                            });
                            var e = Number((t.data.lxb / t.data.total.jda).toFixed(2));
                            t.data.lxb > t.data.total.jda ? t.setData({
                                perfumeNum: 2
                            }) : t.setData({
                                perfumeNum: 1 + e
                            })
                        }
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 12,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 == a.data.length ? t.setData({
                            jda: 0,
                            jdba: 0,
                            jdd: 0
                        }) : t.setData({
                            jda: a.data[0].jda,
                            jdba: a.data[0].jdba,
                            jdd: a.data[0].jdd
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 13,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            addclient: a.data,
                            addfrom: !0
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 14,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            meetclient: a.data,
                            meetfrom: !0
                        })
                    })),
                a.request({
                    url: "https://www.qlsyyun.com:3000/trader",
                    data: {
                        month: t.data.month,
                        arr: 15,
                        zsy: t.data.user[0]
                    }
                }).then((function (a) {
                        0 !== a.data.length && t.setData({
                            nameclient: a.data,
                            namefrom: !0
                        })
                    }))
            }))
    },
    onLoad: function () {
        var t = this;
        wx.createSelectorQuery().select("#perfumeBalance").fields({
            node: !0,
            size: !0
        }).exec((function (a) {
                t.initRing(a)
            }));
        var a = wx.getStorageSync("user");
        t.setData({
            user: a
        })
    },
    initRing: function (t) {
        var a = this,
        e = t[0].node,
        d = e.getContext("2d"),
        n = wx.getSystemInfoSync().pixelRatio;
        e.width = t[0].width * n,
        e.height = t[0].height * n,
        d.scale(n, n);
        d.translate(0, 0),
        function t() {
            d.clearRect(0, 0, e.width, e.height),
            d.beginPath(),
            d.strokeStyle = "#EFEFEF",
            d.lineWidth = 15,
            d.lineCap = "round",
            d.arc(125, 115, 90, Math.PI, 2 * Math.PI, !1),
            d.stroke(),
            d.closePath(),
            d.beginPath(),
            d.lineWidth = 15,
            d.lineCap = "round",
            d.arc(125, 115, 90, Math.PI, a.data.perfumeNum * Math.PI, !1),
            d.strokeStyle = "#3C85F4",
            d.stroke(),
            e.requestAnimationFrame(t)
        }
        ()
    }
});
